Scenario #9310: Create Account and User Subject From Given Subject Uuid and Name

UseCase Create Account For Existing Person => Account: xyz-peter.smith

An account combines an RBAC subject with a natural person and thus grant’s access to data in hsadmin-NG. Here, both the subject UUID (as assigned by Keycloak) and the subject name are given, but no such subject exists yet; thus a new USER subject is created along with the account.

Properties

Given

name value
personFamilyName Smith
personGivenName Peter
personGivenType NATURAL_PERSON
subjectUuid 242a0002-0000-0000-0000-000000000002
subjectName xyz-peter.smith
globalUid 21011
globalGid 21011

Person: Peter Smith

HTTP GET "/api/hs/office/persons?name=Smith&type=NATURAL_PERSON" \
  -H "Authorization: Bearer $HSADMINNG_JWT_BEARER" \
  `# {` \
  `#   "sub" : "uuid<hsh-alex_superuser>"` \
  `# }`
=> status: 200 OK 
[ {
  "uuid" : "bfecf1fc-b92b-47ae-aa84-9d52b57457ef",
  "personType" : "NATURAL_PERSON",
  "tradeName" : null,
  "salutation" : null,
  "title" : null,
  "givenName" : "Peter",
  "familyName" : "Smith"
} ]

In real situations we have more precise measures to find the related person.

theAccount

HTTP POST "/api/hs/accounts/accounts" \
  -H "Authorization: Bearer $HSADMINNG_JWT_BEARER" \
  `# {` \
  `#   "sub" : "uuid<hsh-alex_superuser>"` \
  `# }` \
  -H 'Content-Type: application/json' \
  --data-binary @- <<EOF
{
  "person.uuid" : "bfecf1fc-b92b-47ae-aa84-9d52b57457ef", // Person: Peter Smith
  "subject" : {
    "uuid" : "242a0002-0000-0000-0000-000000000002",
    "name" : "xyz-peter.smith"
  },
  "globalUid" : 21011,
  "globalGid" : 21011
}
EOF
=> status: 201 CREATED 242a0002-0000-0000-0000-000000000002

Verify the new Account as its own Subject

HTTP GET "/api/hs/accounts/accounts/242a0002-0000-0000-0000-000000000002" // theAccount \
  -H "Authorization: Bearer $HSADMINNG_JWT_BEARER" \
  `# {` \
  `#   "sub" : "uuid<xyz-peter.smith>"` \
  `# }`
=> status: 200 OK 
{
  "uuid" : "242a0002-0000-0000-0000-000000000002", // theAccount
  "person" : {
    "uuid" : "bfecf1fc-b92b-47ae-aa84-9d52b57457ef", // Person: Peter Smith
    "personType" : "NATURAL_PERSON",
    "tradeName" : null,
    "salutation" : null,
    "title" : null,
    "givenName" : "Peter",
    "familyName" : "Smith"
  },
  "subject" : {
    "uuid" : "242a0002-0000-0000-0000-000000000002", // theAccount
    "name" : "xyz-peter.smith",
    "type" : "USER"
  },
  "globalUid" : 21011,
  "globalGid" : 21011
}

generated on 2026-07-17 01:42:20 for branch